﻿using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class THR20 
    { 

        public THR20()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VHRSTAMM();
            this.DataContext = MV;
            InitializeComponent();
        } 
       
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            base.Window_Loaded(sender, e);
            LOADALL();
        }
        public override void LOADALL()
        {
            dwData = TBMain.NewRow();
            dwData["HRMANDANT"] = app.Mandant;
            SResult = ((VHRSTAMM)MV).QueryHRSTAMM(dwData, 4);
            MergeData(SResult, false);
            Locate("HRBENID", ORDERNUM);
        }
        public override void LOADBYAUF()
        {
            Locate("HRBENID", ORDERNUM); 
        }
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (vlaue == "")
                return;
            dwData = TBMain.NewRow();
            dwData["HRMANDANT"] = app.Mandant;
            dwData["HRBENID"] = vlaue.PadRight(8).Substring(0,8); 
            SResult = TMV.QHR02(dwData);
            MergeData(SResult, true);
            base.OnEXAUFChg(vlaue);
        }
    }
}
